<!--
 * @Descripttion : 
 * @Autor        : Lilong
 * @Date         : 2022-09-30 10:53:02
 * @LastEditTime : 2022-10-01 16:28:49
 * @FilePath     : \组件\插槽\动态插槽\APP.vue
-->
// src/APP.vue
/**
<h1>这里是Parent组件</h1>
<h1>这里是Child组件</h1>
<ul>
  <li>要替换掉Child中的slot的内容 Feed a cat</li>
  <li>要替换掉Child中的slot的内容 kobe</li>
</ul>
*/

<template>
  <div class="parent">
    <h1>这里是Parent组件</h1>
    <Child>
      <template v-slot:[dynamicSlotName] = "slotProps">
        要替换掉Child中的slot的内容{{slotProps.item}}
      </template>
    </Child>
  </div>
</template>

<script lang="ts">
import { defineComponent, reactive, toRefs } from 'vue'
import Child from './components/child.vue'

export default defineComponent({
  name:"APP",
  components: {
    Child
  },
  setup() {
    const datas = reactive({
      msg: '这个是Parent组件的msg',
      dynamicSlotName: 'haha'
    })

    return {
      ...toRefs(datas)
    }
  }
})
</script>